function AvgTrProbMat=TrProbMat2AvgTrProbMat(TrProbMat,DistVec,UnitNum,TargetDimList)

% TrProbMat   =   SS.TrProb.UnitTrMat.ReEval;
% DistVec     =   SS.Dist_fzo.QW_fzo;
% UnitNum     =   [SS.DistApp.fzo.UnitNum(1),...
%                  PP.ExoState.IdioInc.N,PP.ExoState.Idio_FI.N,PP.ExoState.Idio_RI.N]';
% TargetDimList=  [3,4];
% 


N_Dim       =   length(UnitNum);
AvgTrProbMat=   full(bsxfun(@times,TrProbMat,DistVec'));
Size_MD     =   [UnitNum(:);UnitNum(:)]';
TempSumDims =   sort(setdiff((1:1:N_Dim)',TargetDimList));
SumDims     =   [TempSumDims',N_Dim+TempSumDims'];
AvgTrProbMat=   squeeze(sum(reshape(AvgTrProbMat,Size_MD),SumDims));
AvgTrProbMat=   reshape(AvgTrProbMat,[prod(UnitNum(TargetDimList)),prod(UnitNum(TargetDimList))]);
AvgTrProbMat=   bsxfun(@rdivide,AvgTrProbMat,sum(AvgTrProbMat,1));
